var SceneWebSocket = function(options) {
	this.ctx = options.ctx;
	this.editor = options.editor;
	this.globe = options.editor.globe;
	this.dIndex;
	this.webSocketListener=new Map();
	this.init();
}

SceneWebSocket.prototype.init= function(obj) {
	let _this=this;
	_this.webSocket=new VFG.WebSocket({
		ws:WEBSOKET_URL+'/'+VFG.Util.getUuid(),
		callback:function(e){
			var e = JSON.parse(e); 
			if(_this.webSocketListener.has(e.code)){
				_this.webSocketListener.get(e.code)(e)
			}
		}
	});
	_this.webSocket.createWebSocket();
}

SceneWebSocket.prototype.addWebSocketListener = function(code,callback) {
	var _this = this;
	if(!_this.webSocketListener.has(code)){
		_this.webSocketListener.set(code,callback);
	}
}

SceneWebSocket.prototype.removeWebSocketListener = function(code) {
	var _this = this;
	if(_this.webSocketListener.has(code)){
		_this.webSocketListener.delete(code);
	}
}
